package com.matt.domain;

import com.matt.commons.model.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/26
 * *******************************
 */
@Entity
@Table(name = "teach_operation_log")
@Data
@EqualsAndHashCode(callSuper = true)
public class TeachOperationLog extends Model{

    @Column(columnDefinition = " varchar(20)  COMMENT ' 类型码 ' ")
    private String typeCode;

    @Column(columnDefinition = " varchar(20)  COMMENT ' 类型名 ' ")
    private String typeName;

    @Column(columnDefinition = " varchar(50)  COMMENT ' 操作名 ' ")
    private String operationName;

    @Column(columnDefinition = " varchar(1024)  COMMENT ' 详细描述 ' ")
    private String description;

    @Column(columnDefinition = " varchar(32)  COMMENT ' 管理员id ' ")
    private String staffId;

    @Column(columnDefinition = " varchar(50)  COMMENT ' 管理员姓名 ' ")
    private String staffName;

    @Column(columnDefinition = " varchar(32)  COMMENT ' 对应宝宝id ' ")
    private String childrenId;

    @Column(columnDefinition = " varchar(32)  COMMENT ' 园区id ' ")
    private String areaId;

    @Column(columnDefinition = " datetime  COMMENT ' 创建时间 ' ")
    private Date created = new Date();


    public static TeachOperationLog of(String code, String staffId, String areaId, String staffName, String operationName, String description){
        TeachOperationLog log = new TeachOperationLog();
        log.setTypeCode(code);
        log.setOperationName(operationName);
        log.setDescription(description);
        log.setStaffId(staffId);
        log.setStaffName(staffName);
        log.setAreaId(areaId);
        return log;
    }
}
